package org.jivesoftware.smack;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Presence.Mode;
import org.jivesoftware.smack.packet.Presence.Type;
import org.jivesoftware.smack.packet.RosterPacket;
import org.jivesoftware.smack.packet.RosterPacket.Item;
import org.jivesoftware.smack.packet.RosterPacket.ItemType;
import org.jivesoftware.smack.util.StringUtils;

public class Roster
{
  private static SubscriptionMode defaultSubscriptionMode = SubscriptionMode.accept_all;
  private Connection connection;
  private final Map<String, RosterEntry> entries;
  private final Map<String, RosterGroup> groups;
  private RosterStorage persistentStorage;
  private Map<String, Map<String, Presence>> presenceMap;
  private PresencePacketListener presencePacketListener;
  private String requestPacketId;
  boolean rosterInitialized;
  private final List<RosterListener> rosterListeners;
  private SubscriptionMode subscriptionMode;
  private final List<RosterEntry> unfiledEntries;

  Roster(Connection paramConnection)
  {
    this.rosterInitialized = false;
    this.subscriptionMode = getDefaultSubscriptionMode();
    this.connection = paramConnection;
    if (!(paramConnection.getConfiguration().isRosterVersioningAvailable()))
      this.persistentStorage = null;
    this.groups = new ConcurrentHashMap();
    this.unfiledEntries = new CopyOnWriteArrayList();
    this.entries = new ConcurrentHashMap();
    this.rosterListeners = new CopyOnWriteArrayList();
    this.presenceMap = new ConcurrentHashMap();
    PacketTypeFilter localPacketTypeFilter1 = new PacketTypeFilter(RosterPacket.class);
    paramConnection.addPacketListener(new RosterPacketListener(this, null), localPacketTypeFilter1);
    PacketTypeFilter localPacketTypeFilter2 = new PacketTypeFilter(Presence.class);
    this.presencePacketListener = new PresencePacketListener(this, null);
    paramConnection.addPacketListener(this.presencePacketListener, localPacketTypeFilter2);
    paramConnection.addConnectionListener(new ConnectionListener(this)
    {
      public void connectionClosed()
      {
        Roster.access$10(this.this$0);
      }

      public void connectionClosedOnError()
      {
        Roster.access$10(this.this$0);
      }

      public void reconnectingIn()
      {
      }

      public void reconnectionFailed()
      {
      }

      public void reconnectionSuccessful()
      {
      }
    });
  }

  Roster(Connection paramConnection, RosterStorage paramRosterStorage)
  {
    this(paramConnection);
    this.persistentStorage = paramRosterStorage;
  }

  private void fireRosterChangedEvent(Collection<String> paramCollection1, Collection<String> paramCollection2, Collection<String> paramCollection3)
  {
    Iterator localIterator = this.rosterListeners.iterator();
    while (true)
    {
      RosterListener localRosterListener;
      do
      {
        if (!(localIterator.hasNext()))
          return;
        localRosterListener = (RosterListener)localIterator.next();
        if (!(paramCollection1.isEmpty()))
          localRosterListener.entriesAdded(paramCollection1);
        if (!(paramCollection2.isEmpty()))
          localRosterListener.entriesUpdated(paramCollection2);
      }
      while (paramCollection3.isEmpty());
      localRosterListener.entriesDeleted(paramCollection3);
    }
  }

  private void fireRosterPresenceEvent(Presence paramPresence)
  {
    Iterator localIterator = this.rosterListeners.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
        return;
      ((RosterListener)localIterator.next()).presenceChanged(paramPresence);
    }
  }

  public static SubscriptionMode getDefaultSubscriptionMode()
  {
    return defaultSubscriptionMode;
  }

  private String getPresenceMapKey(String paramString)
  {
    String str2;
    if (paramString == null)
      str2 = null;
    while (true)
    {
      return str2;
      String str1 = paramString;
      if (!(contains(paramString)))
        str1 = StringUtils.parseBareAddress(paramString);
      str2 = str1.toLowerCase();
    }
  }

  private void insertRosterItem(RosterPacket.Item paramItem, Collection<String> paramCollection1, Collection<String> paramCollection2, Collection<String> paramCollection3)
  {
    ArrayList localArrayList1;
    Iterator localIterator1;
    ArrayList localArrayList2;
    Iterator localIterator2;
    Iterator localIterator3;
    Iterator localIterator4;
    Iterator localIterator5;
    RosterEntry localRosterEntry = new RosterEntry(paramItem.getUser(), paramItem.getName(), paramItem.getItemType(), paramItem.getItemStatus(), this, this.connection);
    if (RosterPacket.ItemType.remove.equals(paramItem.getItemType()))
    {
      if (this.entries.containsKey(paramItem.getUser()))
        this.entries.remove(paramItem.getUser());
      if (this.unfiledEntries.contains(localRosterEntry))
        this.unfiledEntries.remove(localRosterEntry);
      String str3 = StringUtils.parseName(paramItem.getUser()) + "@" + StringUtils.parseServer(paramItem.getUser());
      this.presenceMap.remove(str3);
      if (paramCollection3 != null)
        paramCollection3.add(paramItem.getUser());
      localArrayList1 = new ArrayList();
      localIterator1 = getGroups().iterator();
      if (localIterator1.hasNext())
        break label436;
      if (!(RosterPacket.ItemType.remove.equals(paramItem.getItemType())))
      {
        localArrayList2 = new ArrayList();
        localIterator2 = paramItem.getGroupNames().iterator();
        if (localIterator2.hasNext())
          break label474;
        localIterator3 = localArrayList2.iterator();
        if (localIterator3.hasNext())
          break label541;
      }
      localIterator4 = localArrayList1.iterator();
      if (localIterator4.hasNext())
        break label562;
      localIterator5 = getGroups().iterator();
    }
    while (true)
    {
      label407: label436: label474: label612: RosterGroup localRosterGroup4;
      do
      {
        while (true)
        {
          label541: label562: String str2;
          RosterGroup localRosterGroup3;
          do
          {
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  RosterGroup localRosterGroup1;
                  do
                  {
                    while (true)
                    {
                      do
                      {
                        if (localIterator5.hasNext())
                          break label612;
                        return;
                        if (!(this.entries.containsKey(paramItem.getUser())))
                        {
                          this.entries.put(paramItem.getUser(), localRosterEntry);
                          if (paramCollection1 != null)
                            paramCollection1.add(paramItem.getUser());
                        }
                        while (true)
                        {
                          do
                          {
                            while (true)
                            {
                              if (paramItem.getGroupNames().isEmpty())
                                break label407;
                              this.unfiledEntries.remove(localRosterEntry);
                            }
                            this.entries.put(paramItem.getUser(), localRosterEntry);
                          }
                          while (paramCollection2 == null);
                          paramCollection2.add(paramItem.getUser());
                        }
                      }
                      while (this.unfiledEntries.contains(localRosterEntry));
                      this.unfiledEntries.add(localRosterEntry);
                    }
                    localRosterGroup1 = (RosterGroup)localIterator1.next();
                  }
                  while (!(localRosterGroup1.contains(localRosterEntry)));
                  localArrayList1.add(localRosterGroup1.getName());
                }
                String str1 = (String)localIterator2.next();
                localArrayList2.add(str1);
                RosterGroup localRosterGroup2 = getGroup(str1);
                if (localRosterGroup2 == null)
                {
                  localRosterGroup2 = createGroup(str1);
                  this.groups.put(str1, localRosterGroup2);
                }
                localRosterGroup2.addEntryLocal(localRosterEntry);
              }
              localArrayList1.remove((String)localIterator3.next());
            }
            str2 = (String)localIterator4.next();
            localRosterGroup3 = getGroup(str2);
            localRosterGroup3.removeEntryLocal(localRosterEntry);
          }
          while (localRosterGroup3.getEntryCount() != 0);
          this.groups.remove(str2);
        }
        localRosterGroup4 = (RosterGroup)localIterator5.next();
      }
      while (localRosterGroup4.getEntryCount() != 0);
      this.groups.remove(localRosterGroup4.getName());
    }
  }

  private void insertRosterItems(List<RosterPacket.Item> paramList)
  {
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    ArrayList localArrayList3 = new ArrayList();
    Iterator localIterator = paramList.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        fireRosterChangedEvent(localArrayList1, localArrayList2, localArrayList3);
        return;
      }
      insertRosterItem((RosterPacket.Item)localIterator.next(), localArrayList1, localArrayList2, localArrayList3);
    }
  }

  public static void setDefaultSubscriptionMode(SubscriptionMode paramSubscriptionMode)
  {
    defaultSubscriptionMode = paramSubscriptionMode;
  }

  private void setOfflinePresences()
  {
    String str1;
    Map localMap;
    Iterator localIterator1 = this.presenceMap.keySet().iterator();
    do
    {
      if (!(localIterator1.hasNext()))
        return;
      str1 = (String)localIterator1.next();
      localMap = (Map)this.presenceMap.get(str1);
    }
    while (localMap == null);
    Iterator localIterator2 = localMap.keySet().iterator();
    while (true)
    {
      if (!(localIterator2.hasNext()));
      String str2 = (String)localIterator2.next();
      Presence localPresence = new Presence(Presence.Type.unavailable);
      localPresence.setFrom(str1 + "/" + str2);
      this.presencePacketListener.processPacket(localPresence);
    }
  }

  public void addRosterListener(RosterListener paramRosterListener)
  {
    if (!(this.rosterListeners.contains(paramRosterListener)))
      this.rosterListeners.add(paramRosterListener);
  }

  void cleanup()
  {
    this.rosterListeners.clear();
  }

  public boolean contains(String paramString)
  {
    int i;
    if (getEntry(paramString) != null)
      i = 1;
    while (true)
    {
      return i;
      i = 0;
    }
  }

  public void createEntry(String paramString1, String paramString2, String[] paramArrayOfString)
    throws XMPPException
  {
    IQ localIQ;
    int i;
    int j;
    RosterPacket localRosterPacket = new RosterPacket();
    localRosterPacket.setType(IQ.Type.SET);
    RosterPacket.Item localItem = new RosterPacket.Item(paramString1, paramString2);
    if (paramArrayOfString != null)
    {
      i = paramArrayOfString.length;
      j = 0;
    }
    while (true)
    {
      if (j >= i)
      {
        localRosterPacket.addRosterItem(localItem);
        PacketCollector localPacketCollector = this.connection.createPacketCollector(new PacketIDFilter(localRosterPacket.getPacketID()));
        this.connection.sendPacket(localRosterPacket);
        localIQ = (IQ)localPacketCollector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        localPacketCollector.cancel();
        if (localIQ != null)
          break;
        throw new XMPPException("No response from the server.");
      }
      String str = paramArrayOfString[j];
      if ((str != null) && (str.trim().length() > 0))
        localItem.addGroupName(str);
      ++j;
    }
    if (localIQ.getType() == IQ.Type.ERROR)
      throw new XMPPException(localIQ.getError());
    Presence localPresence = new Presence(Presence.Type.subscribe);
    localPresence.setTo(paramString1);
    this.connection.sendPacket(localPresence);
  }

  public RosterGroup createGroup(String paramString)
  {
    if (this.groups.containsKey(paramString))
      throw new IllegalArgumentException("Group with name " + paramString + " alread exists.");
    RosterGroup localRosterGroup = new RosterGroup(paramString, this.connection);
    this.groups.put(paramString, localRosterGroup);
    return localRosterGroup;
  }

  public Collection<RosterEntry> getEntries()
  {
    HashSet localHashSet = new HashSet();
    Iterator localIterator = getGroups().iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        localHashSet.addAll(this.unfiledEntries);
        return Collections.unmodifiableCollection(localHashSet);
      }
      localHashSet.addAll(((RosterGroup)localIterator.next()).getEntries());
    }
  }

  public RosterEntry getEntry(String paramString)
  {
    RosterEntry localRosterEntry;
    if (paramString == null)
      localRosterEntry = null;
    while (true)
    {
      return localRosterEntry;
      localRosterEntry = (RosterEntry)this.entries.get(paramString.toLowerCase());
    }
  }

  public int getEntryCount()
  {
    return getEntries().size();
  }

  public RosterGroup getGroup(String paramString)
  {
    return ((RosterGroup)this.groups.get(paramString));
  }

  public int getGroupCount()
  {
    return this.groups.size();
  }

  public Collection<RosterGroup> getGroups()
  {
    return Collections.unmodifiableCollection(this.groups.values());
  }

  public Presence getPresence(String paramString)
  {
    Object localObject1;
    String str = getPresenceMapKey(StringUtils.parseBareAddress(paramString));
    Map localMap = (Map)this.presenceMap.get(str);
    if (localMap == null)
    {
      Presence localPresence1 = new Presence(Presence.Type.unavailable);
      localPresence1.setFrom(paramString);
      localObject1 = localPresence1;
    }
    while (true)
    {
      return localObject1;
      Object localObject2 = null;
      Iterator localIterator = localMap.keySet().iterator();
      while (true)
      {
        Presence localPresence2;
        Presence.Mode localMode1;
        Presence.Mode localMode2;
        do
        {
          do
            while (true)
            {
              do
              {
                while (!(localIterator.hasNext()))
                {
                  if (localObject2 != null)
                    break label226;
                  Presence localPresence3 = new Presence(Presence.Type.unavailable);
                  localPresence3.setFrom(paramString);
                  localObject1 = localPresence3;
                }
                localPresence2 = (Presence)localMap.get((String)localIterator.next());
              }
              while (!(localPresence2.isAvailable()));
              if ((localObject2 != null) && (localPresence2.getPriority() <= localObject2.getPriority()))
                break;
              localObject2 = localPresence2;
            }
          while (localPresence2.getPriority() != localObject2.getPriority());
          localMode1 = localPresence2.getMode();
          if (localMode1 == null)
            localMode1 = Presence.Mode.available;
          localMode2 = localObject2.getMode();
          if (localMode2 == null)
            localMode2 = Presence.Mode.available;
        }
        while (localMode1.compareTo(localMode2) >= 0);
        localObject2 = localPresence2;
      }
      label226: localObject1 = localObject2;
    }
  }

  public Presence getPresenceResource(String paramString)
  {
    Object localObject;
    String str1 = getPresenceMapKey(paramString);
    String str2 = StringUtils.parseResource(paramString);
    Map localMap = (Map)this.presenceMap.get(str1);
    if (localMap == null)
    {
      Presence localPresence1 = new Presence(Presence.Type.unavailable);
      localPresence1.setFrom(paramString);
      localObject = localPresence1;
    }
    while (true)
    {
      Presence localPresence2;
      while (true)
      {
        return localObject;
        localPresence2 = (Presence)localMap.get(str2);
        if (localPresence2 != null)
          break;
        Presence localPresence3 = new Presence(Presence.Type.unavailable);
        localPresence3.setFrom(paramString);
        localObject = localPresence3;
      }
      localObject = localPresence2;
    }
  }

  public Iterator<Presence> getPresences(String paramString)
  {
    Iterator localIterator1;
    String str = getPresenceMapKey(paramString);
    Map localMap = (Map)this.presenceMap.get(str);
    if (localMap == null)
    {
      Presence localPresence1 = new Presence(Presence.Type.unavailable);
      localPresence1.setFrom(paramString);
      Presence[] arrayOfPresence1 = new Presence[1];
      arrayOfPresence1[0] = localPresence1;
      localIterator1 = Arrays.asList(arrayOfPresence1).iterator();
    }
    while (true)
    {
      return localIterator1;
      ArrayList localArrayList = new ArrayList();
      Iterator localIterator2 = localMap.values().iterator();
      while (true)
      {
        Presence localPresence2;
        do
        {
          while (!(localIterator2.hasNext()))
          {
            if (localArrayList.isEmpty())
              break label156;
            localIterator1 = localArrayList.iterator();
          }
          localPresence2 = (Presence)localIterator2.next();
        }
        while (!(localPresence2.isAvailable()));
        localArrayList.add(localPresence2);
      }
      label156: Presence localPresence3 = new Presence(Presence.Type.unavailable);
      localPresence3.setFrom(paramString);
      Presence[] arrayOfPresence2 = new Presence[1];
      arrayOfPresence2[0] = localPresence3;
      localIterator1 = Arrays.asList(arrayOfPresence2).iterator();
    }
  }

  public Map<String, Map<String, Presence>> getPresences()
  {
    return this.presenceMap;
  }

  public SubscriptionMode getSubscriptionMode()
  {
    return this.subscriptionMode;
  }

  public Collection<RosterEntry> getUnfiledEntries()
  {
    return Collections.unmodifiableList(this.unfiledEntries);
  }

  public int getUnfiledEntryCount()
  {
    return this.unfiledEntries.size();
  }

  public void reload()
  {
    RosterPacket localRosterPacket = new RosterPacket();
    if (this.persistentStorage != null)
      localRosterPacket.setVersion(this.persistentStorage.getRosterVersion());
    this.requestPacketId = localRosterPacket.getPacketID();
    PacketIDFilter localPacketIDFilter = new PacketIDFilter(this.requestPacketId);
    this.connection.addPacketListener(new RosterResultListener(this, null), localPacketIDFilter);
    this.connection.sendPacket(localRosterPacket);
  }

  public void removeEntry(RosterEntry paramRosterEntry)
    throws XMPPException
  {
    IQ localIQ;
    if (!(this.entries.containsKey(paramRosterEntry.getUser())));
    do
    {
      return;
      RosterPacket localRosterPacket = new RosterPacket();
      localRosterPacket.setType(IQ.Type.SET);
      RosterPacket.Item localItem = RosterEntry.toRosterItem(paramRosterEntry);
      localItem.setItemType(RosterPacket.ItemType.remove);
      localRosterPacket.addRosterItem(localItem);
      PacketCollector localPacketCollector = this.connection.createPacketCollector(new PacketIDFilter(localRosterPacket.getPacketID()));
      this.connection.sendPacket(localRosterPacket);
      localIQ = (IQ)localPacketCollector.nextResult(SmackConfiguration.getPacketReplyTimeout());
      localPacketCollector.cancel();
      if (localIQ == null)
        throw new XMPPException("No response from the server.");
    }
    while (localIQ.getType() != IQ.Type.ERROR);
    throw new XMPPException(localIQ.getError());
  }

  public void removeRosterListener(RosterListener paramRosterListener)
  {
    this.rosterListeners.remove(paramRosterListener);
  }

  public void setSubscriptionMode(SubscriptionMode paramSubscriptionMode)
  {
    this.subscriptionMode = paramSubscriptionMode;
  }

  private class PresencePacketListener
  implements PacketListener
  {
    public void processPacket()
    {
      label432: label491: Object localObject1;
      Object localObject3;
      Presence localPresence1 = (Presence)paramPacket;
      String str1 = localPresence1.getFrom();
      String str2 = Roster.access$0(this.this$0, str1);
      if (localPresence1.getType() == Presence.Type.available)
        if (Roster.access$1(this.this$0).get(str2) == null)
        {
          localObject3 = new ConcurrentHashMap();
          Roster.access$1(this.this$0).put(str2, localObject3);
          ((Map)localObject3).remove("");
          ((Map)localObject3).put(StringUtils.parseResource(str1), localPresence1);
          if ((RosterEntry)Roster.access$2(this.this$0).get(str2) != null)
            Roster.access$3(this.this$0, localPresence1);
        }
      do
        while (true)
        {
          do
          {
            while (true)
            {
              do
                while (true)
                {
                  while (true)
                  {
                    return;
                    localObject3 = (Map)Roster.access$1(this.this$0).get(str2);
                  }
                  if (localPresence1.getType() == Presence.Type.unavailable)
                  {
                    Object localObject2;
                    if ("".equals(StringUtils.parseResource(str1)))
                      if (Roster.access$1(this.this$0).get(str2) == null)
                      {
                        localObject2 = new ConcurrentHashMap();
                        Roster.access$1(this.this$0).put(str2, localObject2);
                        ((Map)localObject2).put("", localPresence1);
                      }
                    while (true)
                    {
                      do
                        while (true)
                        {
                          while (true)
                          {
                            if ((RosterEntry)Roster.access$2(this.this$0).get(str2) == null);
                            Roster.access$3(this.this$0, localPresence1);
                          }
                          localObject2 = (Map)Roster.access$1(this.this$0).get(str2);
                        }
                      while (Roster.access$1(this.this$0).get(str2) == null);
                      ((Map)Roster.access$1(this.this$0).get(str2)).put(StringUtils.parseResource(str1), localPresence1);
                    }
                  }
                  if (localPresence1.getType() != Presence.Type.subscribe)
                    break label432;
                  if (Roster.access$4(this.this$0) != Roster.SubscriptionMode.accept_all)
                    break;
                  Presence localPresence3 = new Presence(Presence.Type.subscribed);
                  localPresence3.setTo(localPresence1.getFrom());
                  Roster.access$5(this.this$0).sendPacket(localPresence3);
                }
              while (Roster.access$4(this.this$0) != Roster.SubscriptionMode.reject_all);
              Presence localPresence4 = new Presence(Presence.Type.unsubscribed);
              localPresence4.setTo(localPresence1.getFrom());
              Roster.access$5(this.this$0).sendPacket(localPresence4);
            }
            if (localPresence1.getType() != Presence.Type.unsubscribe)
              break label491;
          }
          while (Roster.access$4(this.this$0) == Roster.SubscriptionMode.manual);
          Presence localPresence2 = new Presence(Presence.Type.unsubscribed);
          localPresence2.setTo(localPresence1.getFrom());
          Roster.access$5(this.this$0).sendPacket(localPresence2);
        }
      while ((localPresence1.getType() != Presence.Type.error) || (!("".equals(StringUtils.parseResource(str1)))));
      if (!(Roster.access$1(this.this$0).containsKey(str2)))
      {
        localObject1 = new ConcurrentHashMap();
        Roster.access$1(this.this$0).put(str2, localObject1);
      }
      while (true)
      {
        while (true)
        {
          do
            ((Map)localObject1).put("", localPresence1);
          while ((RosterEntry)Roster.access$2(this.this$0).get(str2) == null);
          Roster.access$3(this.this$0, localPresence1);
        }
        localObject1 = (Map)Roster.access$1(this.this$0).get(str2);
        ((Map)localObject1).clear();
      }
    }
  }

  private class RosterPacketListener
  implements PacketListener
  {
    // ERROR //
    public void processPacket()
    {
      // Byte code:
      //   0: new 25	java/util/ArrayList
      //   3: dup
      //   4: invokespecial 26	java/util/ArrayList:<init>	()V
      //   7: astore_2
      //   8: new 25	java/util/ArrayList
      //   11: dup
      //   12: invokespecial 26	java/util/ArrayList:<init>	()V
      //   15: astore_3
      //   16: new 25	java/util/ArrayList
      //   19: dup
      //   20: invokespecial 26	java/util/ArrayList:<init>	()V
      //   23: astore 4
      //   25: aconst_null
      //   26: astore 5
      //   28: aload_1
      //   29: checkcast 28	org/jivesoftware/smack/packet/RosterPacket
      //   32: astore 6
      //   34: new 25	java/util/ArrayList
      //   37: dup
      //   38: invokespecial 26	java/util/ArrayList:<init>	()V
      //   41: astore 7
      //   43: aload 6
      //   45: invokevirtual 32	org/jivesoftware/smack/packet/RosterPacket:getRosterItems	()Ljava/util/Collection;
      //   48: invokeinterface 38 1 0
      //   53: astore 8
      //   55: aload 8
      //   57: invokeinterface 44 1 0
      //   62: ifne +158 -> 220
      //   65: aload 6
      //   67: invokevirtual 48	org/jivesoftware/smack/packet/RosterPacket:getVersion	()Ljava/lang/String;
      //   70: ifnonnull +171 -> 241
      //   73: aload_0
      //   74: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   77: aconst_null
      //   78: invokestatic 52	org/jivesoftware/smack/Roster:access$9	(Lorg/jivesoftware/smack/Roster;Lorg/jivesoftware/smack/RosterStorage;)V
      //   81: aload_0
      //   82: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   85: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   88: ifnull +42 -> 130
      //   91: aload_0
      //   92: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   95: getfield 60	org/jivesoftware/smack/Roster:rosterInitialized	Z
      //   98: ifne +32 -> 130
      //   101: aload_0
      //   102: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   105: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   108: invokeinterface 66 1 0
      //   113: invokeinterface 69 1 0
      //   118: astore 16
      //   120: aload 16
      //   122: invokeinterface 44 1 0
      //   127: ifne +124 -> 251
      //   130: aload 7
      //   132: invokeinterface 69 1 0
      //   137: astore 10
      //   139: aload 10
      //   141: invokeinterface 44 1 0
      //   146: ifne +126 -> 272
      //   149: aload_0
      //   150: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   153: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   156: ifnull +25 -> 181
      //   159: aload 6
      //   161: invokevirtual 32	org/jivesoftware/smack/packet/RosterPacket:getRosterItems	()Ljava/util/Collection;
      //   164: invokeinterface 38 1 0
      //   169: astore 14
      //   171: aload 14
      //   173: invokeinterface 44 1 0
      //   178: ifne +122 -> 300
      //   181: aload_0
      //   182: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   185: astore 12
      //   187: aload 12
      //   189: monitorenter
      //   190: aload_0
      //   191: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   194: iconst_1
      //   195: putfield 60	org/jivesoftware/smack/Roster:rosterInitialized	Z
      //   198: aload_0
      //   199: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   202: invokevirtual 72	java/lang/Object:notifyAll	()V
      //   205: aload 12
      //   207: monitorexit
      //   208: aload_0
      //   209: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   212: aload_2
      //   213: aload_3
      //   214: aload 4
      //   216: invokestatic 76	org/jivesoftware/smack/Roster:access$8	(Lorg/jivesoftware/smack/Roster;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;)V
      //   219: return
      //   220: aload 7
      //   222: aload 8
      //   224: invokeinterface 80 1 0
      //   229: checkcast 82	org/jivesoftware/smack/packet/RosterPacket$Item
      //   232: invokeinterface 86 2 0
      //   237: pop
      //   238: goto -183 -> 55
      //   241: aload 6
      //   243: invokevirtual 48	org/jivesoftware/smack/packet/RosterPacket:getVersion	()Ljava/lang/String;
      //   246: astore 5
      //   248: goto -167 -> 81
      //   251: aload 7
      //   253: aload 16
      //   255: invokeinterface 80 1 0
      //   260: checkcast 82	org/jivesoftware/smack/packet/RosterPacket$Item
      //   263: invokeinterface 86 2 0
      //   268: pop
      //   269: goto -149 -> 120
      //   272: aload 10
      //   274: invokeinterface 80 1 0
      //   279: checkcast 82	org/jivesoftware/smack/packet/RosterPacket$Item
      //   282: astore 11
      //   284: aload_0
      //   285: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   288: aload 11
      //   290: aload_2
      //   291: aload_3
      //   292: aload 4
      //   294: invokestatic 90	org/jivesoftware/smack/Roster:access$7	(Lorg/jivesoftware/smack/Roster;Lorg/jivesoftware/smack/packet/RosterPacket$Item;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;)V
      //   297: goto -158 -> 139
      //   300: aload 14
      //   302: invokeinterface 80 1 0
      //   307: checkcast 82	org/jivesoftware/smack/packet/RosterPacket$Item
      //   310: astore 15
      //   312: aload 15
      //   314: invokevirtual 94	org/jivesoftware/smack/packet/RosterPacket$Item:getItemType	()Lorg/jivesoftware/smack/packet/RosterPacket$ItemType;
      //   317: getstatic 100	org/jivesoftware/smack/packet/RosterPacket$ItemType:remove	Lorg/jivesoftware/smack/packet/RosterPacket$ItemType;
      //   320: invokevirtual 103	org/jivesoftware/smack/packet/RosterPacket$ItemType:equals	(Ljava/lang/Object;)Z
      //   323: ifeq +23 -> 346
      //   326: aload_0
      //   327: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   330: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   333: aload 15
      //   335: invokevirtual 106	org/jivesoftware/smack/packet/RosterPacket$Item:getUser	()Ljava/lang/String;
      //   338: invokeinterface 110 2 0
      //   343: goto -172 -> 171
      //   346: aload_0
      //   347: getfield 15	org/jivesoftware/smack/Roster$RosterPacketListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   350: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   353: aload 15
      //   355: aload 5
      //   357: invokeinterface 114 3 0
      //   362: goto -191 -> 171
      //   365: astore 13
      //   367: aload 12
      //   369: monitorexit
      //   370: aload 13
      //   372: athrow
      //
      // Exception table:
      //   from	to	target	type
      //   190	208	365	finally
      //   367	370	365	finally
    }
  }

  private class RosterResultListener
  implements PacketListener
  {
    // ERROR //
    public void processPacket()
    {
      // Byte code:
      //   0: aload_1
      //   1: instanceof 25
      //   4: ifeq +137 -> 141
      //   7: aload_1
      //   8: checkcast 25	org/jivesoftware/smack/packet/IQ
      //   11: astore_2
      //   12: aload_2
      //   13: invokevirtual 29	org/jivesoftware/smack/packet/IQ:getType	()Lorg/jivesoftware/smack/packet/IQ$Type;
      //   16: getstatic 35	org/jivesoftware/smack/packet/IQ$Type:RESULT	Lorg/jivesoftware/smack/packet/IQ$Type;
      //   19: invokevirtual 39	java/lang/Object:equals	(Ljava/lang/Object;)Z
      //   22: ifeq +119 -> 141
      //   25: aload_2
      //   26: invokevirtual 43	org/jivesoftware/smack/packet/IQ:getExtensions	()Ljava/util/Collection;
      //   29: invokeinterface 49 1 0
      //   34: ifeq +107 -> 141
      //   37: new 51	java/util/ArrayList
      //   40: dup
      //   41: invokespecial 52	java/util/ArrayList:<init>	()V
      //   44: astore_3
      //   45: new 51	java/util/ArrayList
      //   48: dup
      //   49: invokespecial 52	java/util/ArrayList:<init>	()V
      //   52: astore 4
      //   54: new 51	java/util/ArrayList
      //   57: dup
      //   58: invokespecial 52	java/util/ArrayList:<init>	()V
      //   61: astore 5
      //   63: aload_0
      //   64: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   67: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   70: ifnull +71 -> 141
      //   73: aload_0
      //   74: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   77: invokestatic 56	org/jivesoftware/smack/Roster:access$6	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/RosterStorage;
      //   80: invokeinterface 62 1 0
      //   85: invokeinterface 68 1 0
      //   90: astore 6
      //   92: aload 6
      //   94: invokeinterface 73 1 0
      //   99: ifne +54 -> 153
      //   102: aload_0
      //   103: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   106: astore 8
      //   108: aload 8
      //   110: monitorenter
      //   111: aload_0
      //   112: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   115: iconst_1
      //   116: putfield 77	org/jivesoftware/smack/Roster:rosterInitialized	Z
      //   119: aload_0
      //   120: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   123: invokevirtual 80	java/lang/Object:notifyAll	()V
      //   126: aload 8
      //   128: monitorexit
      //   129: aload_0
      //   130: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   133: aload_3
      //   134: aload 4
      //   136: aload 5
      //   138: invokestatic 84	org/jivesoftware/smack/Roster:access$8	(Lorg/jivesoftware/smack/Roster;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;)V
      //   141: aload_0
      //   142: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   145: invokestatic 88	org/jivesoftware/smack/Roster:access$5	(Lorg/jivesoftware/smack/Roster;)Lorg/jivesoftware/smack/Connection;
      //   148: aload_0
      //   149: invokevirtual 94	org/jivesoftware/smack/Connection:removePacketListener	(Lorg/jivesoftware/smack/PacketListener;)V
      //   152: return
      //   153: aload 6
      //   155: invokeinterface 98 1 0
      //   160: checkcast 100	org/jivesoftware/smack/packet/RosterPacket$Item
      //   163: astore 7
      //   165: aload_0
      //   166: getfield 15	org/jivesoftware/smack/Roster$RosterResultListener:this$0	Lorg/jivesoftware/smack/Roster;
      //   169: aload 7
      //   171: aload_3
      //   172: aload 4
      //   174: aload 5
      //   176: invokestatic 104	org/jivesoftware/smack/Roster:access$7	(Lorg/jivesoftware/smack/Roster;Lorg/jivesoftware/smack/packet/RosterPacket$Item;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;)V
      //   179: goto -87 -> 92
      //   182: astore 9
      //   184: aload 8
      //   186: monitorexit
      //   187: aload 9
      //   189: athrow
      //
      // Exception table:
      //   from	to	target	type
      //   111	129	182	finally
      //   184	187	182	finally
    }
  }

  public static enum SubscriptionMode
  {
    static
    {
      manual = new SubscriptionMode("manual", 2);
      SubscriptionMode[] arrayOfSubscriptionMode = new SubscriptionMode[3];
      arrayOfSubscriptionMode[0] = accept_all;
      arrayOfSubscriptionMode[1] = reject_all;
      arrayOfSubscriptionMode[2] = manual;
      ENUM$VALUES = arrayOfSubscriptionMode;
    }
  }
}